﻿using System; 
using System.Collections.Generic;
using System.Text;
using XXX.Models;
using fuzhu;
using System.Data; 
using XXX.Models.XXXEntities;
using LH.U8API.Bus;
using XXX.Common;
using System.Data.SqlClient;
using GLY_XieTong;
using Newtonsoft.Json; 
using System.Runtime.ConstrainedExecution;
using SqlSugar;
using ZDEntity;
using System.Reflection.Emit; 
using System.Collections;

namespace XXX.Bo
{
   public static partial class DBService
    {
          
        //不是list的，直接是类。适用于给前端的返回，
        public static RetModel2 ReOK2(object reData)
        {
            RetModel2 retModel = new RetModel2();
            retModel.code = 200;
            retModel.message = null;
            retModel.data = reData;
            return retModel;
        }

        ////不是list的，直接是类
        //public static RetModel2  ReOK2<T>(T reData)
        //{
        //    RetModel2 retModel = new RetModel2();
        //    retModel.code = 200;
        //    retModel.message = null;
        //    retModel.data = reData;
        //    return retModel;
        //}

        //public static RetModel2 ReError2(string message)
        //{
        //    RetModel2 retModel = new RetModel2();
        //    retModel.code = 300;
        //    retModel.message = message;
        //    return retModel;
        //}


        //不是list的，直接是类。如果是列表，增加一个list属性
        public static RetModel3<T> ReOK3<T>(T reData)
        {
            RetModel3<T> retModel = new RetModel3<T>();
            retModel.code = 200;
            retModel.message = null;
            retModel.data = reData;
            return retModel;
        }

        public static RetModel3<List<T>> ReOK3List<T>(List<T> reData)
        {
            RetModel3<List<T>> retModel = new RetModel3<List<T>>();
            retModel.code = 200;
            retModel.message = null;
            retModel.data = reData;
            return retModel;
        }

     

        public static RetModel3<T> ReError3<T>(string message)
        {
            RetModel3<T> retModel = new RetModel3<T>();
            retModel.code = 300;
            retModel.message = message;
            return retModel;
        }


        public static RetModel<T> ReOK<T>(List<T> reData)
        {
            RetModel<T> retModel = new RetModel<T>();
            retModel.code = 200;
            retModel.message = null;
            retModel.data = reData;
            return retModel;
        }

        ////返回一个组成列表
        //public static RetModel<T> ReOKData<T>(T reData)
        //{
        //    RetModel<T> retModel = new RetModel<T>();
        //    retModel.code = 200;
        //    retModel.message = null;
        //    List<T> lst  = new List<T>();
        //    lst.Add(reData);
        //    retModel.data = lst;
        //    return retModel;
        //}

        public static RetModel<T> ReError<T>(string msg)
        {
            RetModel<T> retModel = new RetModel<T>();
            retModel.code = 300;
            retModel.message = msg;
            return retModel;
        }

        public static RetModel ReOK(List<object> reData )
        {
            RetModel retModel = new RetModel();
            retModel.code = 200;
            retModel.message = null;
            retModel.data = reData;
            return retModel;
         }
        public static RetModel ReError(string msg)
        {
            RetModel retModel = new RetModel();
            retModel.code =300;
            retModel.message = msg;
            retModel.data = null;
            return retModel;
        }

        public static RetModelbool ReOKbool()
        {
            RetModelbool retModel = new RetModelbool();
            retModel.code = 200;
            retModel.data = true; 
            return retModel;
        }

        public static RetModelbool ReOKbool(string msg)
        {
            RetModelbool retModel = new RetModelbool();
            retModel.code = 200;
            retModel.message= msg;
            retModel.data = true;
            return retModel;
        }
        public static RetModelbool ReErrorbool(string msg)
        {
            RetModelbool retModel = new RetModelbool();
            retModel.code = 300;
            retModel.message = msg;
            retModel.data = false;
            return retModel;
        }

        public static RetModel2 ReErrObject(string msg)
        {
            RetModel2 retModel = new RetModel2();
            retModel.code = 300;
            retModel.message = msg;
            retModel.data = null;
            return retModel;
        }

        public static Task<RetModel2> ReErrObjectAsyn(string msg)
        {
            RetModel2 retModel = new RetModel2();
            retModel.code = 300;
            retModel.message = msg;
            retModel.data = null;
            return Task.FromResult(retModel);
        }

        public static RetModel2 ReErrObjectData(string msg,object reDate)
        {
            RetModel2 retModel = new RetModel2();
            retModel.code = 300;
            retModel.message = msg;
            retModel.data = reDate;
            return retModel;
        }

        //不是list的，直接是类
        public static RetModel2 ReOKObject(object reData)
        {
            RetModel2 retModel = new RetModel2();
            retModel.code = 200;
            retModel.message = "操作成功";
            retModel.data = reData;
            return retModel;
        }
        public static Task<RetModel2> ReOKObjectAsyn(object reData)
        {
            RetModel2 retModel = new RetModel2();
            retModel.code = 200;
            retModel.message = "操作成功";
            retModel.data = reData;
            return Task.FromResult(retModel);
        }
        public static RetModel2 ReOKMsg(string reData)
        {
            RetModel2 retModel = new RetModel2();
            retModel.code = 200;
            retModel.message = reData;
            retModel.data = null;
            return retModel;
        }
    }
}
